<template>
  <view class="container">
		<nav-ber :title="'我的消息'" :bgColor="'#f7f8ff'"></nav-ber>
		<view class="province">
			<view class="mag_flex" v-for="(item, index) in magList" :key="index" @click="cheackFun(item)">
				<view class="ico_bg">
					<u-icon name="volume-fill" size="20" color="rgb(255, 169, 5)"></u-icon>
				</view>
				<view style="flex: 1;">
					<view class="tit_flex">
						<span class="font_w">{{ item.title }}</span>
						<span style="font-size: 25rpx;color: gray;">{{ item.createTime }}</span>
					</view>
					<view class="text_sty" style="font-size: 25rpx;color: gray;margin-top: 10rpx;">
						{{ item.content }}
					</view>
				</view>
			</view>
			<u-empty style="margin-top: 200rpx;" v-if="!magList.length" text="暂无数据" mode="list"></u-empty>
		</view>
  </view>
</template>
<script>
	import { messageList } from '@/api/personalCenter.js'
  export default {
    data() {
			return {
				keyword: '',
				ispro: '1',
				magList: [],
			}
    },
		onShow() {
			this.messageListFun()
		},
		methods: {
			cheackFun(item) {
				uni.navigateTo({
					url: "/pages/personalCenter/myMessageCheack/index?id=" + item.id
				})
			},
			proFun(val) {
				this.ispro = val
			},
			messageListFun() {
				messageList({
					userId: JSON.parse(uni.getStorageSync('userInfo')).userId,
					pageNum: 1,
					pageSize: 1000
				}).then((res) => {
					this.magList = res.rows
				})
			},
		}
  }
</script>
<style lang="scss" scoped>
	.container {
		background-color: #f7f8ff;
		display: flex;
		flex-direction: column;
		height: 100vh;
		overflow: hidden;
	}
	.province {
		flex: 1;
		overflow: scroll;
		padding: 0 20rpx;
		margin-top: 20rpx;
	}
	.mag_flex {
		width: 100%;
		display: flex;
		align-items: center;
		background-color: #fff;
		padding: 20rpx;
		box-sizing: border-box;
		border-radius: 15rpx;
		margin-bottom: 25rpx;
	}
	.mag_flex:first-child {
		margin-top: 20rpx;
	}
	.ico_bg {
		background-color: rgba(255, 169, 5, 0.1);
		width: 90rpx;
		height: 90rpx;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-right: 20rpx;
		box-sizing: border-box;
	}
	.font_w {
		font-weight: 900;
	}
	.tit_flex {
		width: 100%;
		display: flex;
		justify-content: space-between;;
	}
	.text_sty {
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;					
		-webkit-box-orient: vertical;
	}
</style>
